<!DOCTYPE html>
<meta charset="utf-8">
<title>Non-parser-inserted style elements should still work</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#update-a-style-block">
<link rel="help" href="https://drafts.csswg.org/cssom/#the-linkstyle-interface">

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<p>Test</p>

<script>
"use strict";

setup({ single_test: true });

const el = document.createElement("style");
el.textContent = "p { color: rgb(1, 2, 3); }";
document.head.appendChild(el);

assert_not_equals(el.sheet, null);
assert_true(el.sheet instanceof CSSStyleSheet);
assert_array_equals(document.styleSheets, [el.sheet]);

assert_equals(getComputedStyle(document.querySelector("p")).color, "rgb(1, 2, 3)");

done();
</script>
